package com.mingqijia.gassafety.console.controller;


import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.shared.utils.ApplicationUtils;
import com.mingqijia.gassafety.webserver.request.UpdateDeviceStateRequest;
import com.mingqijia.gassafety.webserver.service.DeviceStateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "设备离线内部接口")
@RestController(value = "LatesLogtInnerController")
@RequestMapping("")
public class LatesLogtInnerController {

    @Autowired
    DeviceStateService deviceStateService;

    @PostMapping("/inner/v1/latest/log")
    @ApiOperation(value = "设备周期离线消息发送")
    public CommonResponse<Object> updateDeviceStateList(@RequestBody List<UpdateDeviceStateRequest> request) {
        boolean deviceState = deviceStateService.updateDeviceStateList(request);
        return CommonResponse.success(deviceState);
    }
}
